package com.adminsystem.service.impl;

import java.util.List;

import com.adminsystem.entity.ExamPaperJoinQuestion;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.adminsystem.mapper.ExamPaperManageMapper;
import com.adminsystem.entity.ExamPaperManage;
import com.adminsystem.service.IExamPaperManageService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 试卷管理Service业务层处理
 * 
 * @author admin
 * @date 2023-11-26
 */
@Service
public class ExamPaperManageServiceImpl extends ServiceImpl<ExamPaperManageMapper, ExamPaperManage> implements IExamPaperManageService
{
    @Autowired
    private ExamPaperManageMapper examPaperManageMapper;

    /**
     * 查询试卷管理
     * 
     * @param paperId 试卷管理主键
     * @return 试卷管理
     */
    @Override
    public ExamPaperManage selectExamPaperManageByPaperId(Long paperId)
    {
        return examPaperManageMapper.selectExamPaperManageByPaperId(paperId);
    }

    /**
     * 查询试卷管理列表
     * 
     * @param examPaperManage 试卷管理
     * @return 试卷管理
     */
    @Override
    public List<ExamPaperManage> selectExamPaperManageList(ExamPaperManage examPaperManage)
    {
        return examPaperManageMapper.selectExamPaperManageList(examPaperManage);
    }

    /**
     * 新增试卷管理
     * 
     * @param examPaperManage 试卷管理
     * @return 结果
     */
    @Override
    public int insertExamPaperManage(ExamPaperManage examPaperManage)
    {
        examPaperManage.setCreateTime(DateUtils.getNowDate());
        return examPaperManageMapper.insertExamPaperManage(examPaperManage);
    }

    /**
     * 修改试卷管理
     * 
     * @param examPaperManage 试卷管理
     * @return 结果
     */
    @Override
    public int updateExamPaperManage(ExamPaperManage examPaperManage)
    {
        examPaperManage.setUpdateTime(DateUtils.getNowDate());
        return examPaperManageMapper.updateExamPaperManage(examPaperManage);
    }

    /**
     * 批量删除试卷管理
     * 
     * @param paperIds 需要删除的试卷管理主键
     * @return 结果
     */
    @Override
    public int deleteExamPaperManageByPaperIds(Long[] paperIds)
    {
        return examPaperManageMapper.deleteExamPaperManageByPaperIds(paperIds);
    }

    /**
     * 删除试卷管理信息
     * 
     * @param paperId 试卷管理主键
     * @return 结果
     */
    @Override
    public int deleteExamPaperManageByPaperId(Long paperId)
    {
        return examPaperManageMapper.deleteExamPaperManageByPaperId(paperId);
    }

    @Override
    public int removeByPaperAndQuestionId(List<ExamPaperJoinQuestion> examPaperJoinQuestionList)
    {
        return examPaperManageMapper.removeByPaperAndQuestionId(examPaperJoinQuestionList);
    }
}
